using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThermalImagery.Model;
using ThermalImagery.Service;
using Leeder.Business;

namespace ThermalImagery.Business
{
    /// <summary>
    /// 
    /// </summary>
   public class PictureBLL : BaseBLL<PictureModel, PictureService>
   {
        public PictureBLL()
        {
            Service = new PictureService();
        }
        public List<PictureModel> GetModelAll()
        {
            return Service.Query(p => (p.IsPhantom != true || p.IsPhantom == null)).ActivedObj;
        }
        public List<PictureModel> GetModelByCheckId(long id)
        {
            return Service.Query(p => p.ThermalCheckId == id && (p.IsPhantom != true || p.IsPhantom == null)).ActivedObj;
        }
        public PictureModel GetModel()
        {
            return Service.Query(p => (p.IsPhantom != true || p.IsPhantom == null)).ActivedObj.FirstOrDefault();
        }

        public bool AddList(List<PictureModel> list)
        {
            foreach (var item in list)
            {
                if (!Service.Add(item).IsSuccess)
                    return false;
            }
            return true;
        }
    }
}
